USE master;
GO
SET NOCOUNT ON
DECLARE @startdate datetime, @adddays int
SET @startdate = '1/10/1900 12:00 AM'
SET @adddays = 5
SET NOCOUNT OFF
SELECT @startdate + 1.25 AS 'Start Date', 
   @startdate + @adddays AS 'Add Date'

DECLARE @addvalue int
SET @addvalue = 15
SELECT '125127' + @addvalue

Declare @newvalue float, @intvalue int
SET @newvalue = 5.5
SET @intvalue = 10
SElect '12' + @newvalue + @intvalue

DECLARE @mybin1 binary(5), @mybin2 binary(5)
SET @mybin1 = 0xFF
SET @mybin2 = 0xA5
-- No CONVERT or CAST function is required because this example 
-- concatenates two binary strings.
SELECT @mybin1 + @mybin2
-- A CONVERT or CAST function is required because this example
-- concatenates two binary strings plus a space.
SELECT CONVERT(varchar(5), @mybin1) + ' ' 
   + CONVERT(varchar(5), @mybin2)
-- Here is the same conversion using CAST.
SELECT CAST(@mybin1 AS varchar(5)) + ' ' 
   + CAST(@mybin2 AS varchar(5))


USE AdventureWorks;
GO
SELECT (LastName + ', ' + FirstName) AS Name
FROM Person.Contact
ORDER BY LastName ASC, FirstName ASC;

Select 'Phyo' + space(1) + 'Kyaw' + space(5) + 'Thant'


USE AdventureWorks;
GO
SELECT (LastName + ',' + SPACE(1) + SUBSTRING(FirstName, 1, 1) + '.') AS Name, e.Title
FROM Person.Contact AS c
    JOIN HumanResources.Employee AS e
    ON c.ContactID = e.ContactID
WHERE e.Title LIKE 'Vice%'
ORDER BY LastName ASC;
GO

USE tempdb;
GO
DECLARE @MyNumber decimal(11,2);
SET @MyNumber = -1000000000.99;
Select @@Error
SELECT @MyNumber;

GO

USE tempdb;
GO
DECLARE @Num1 int;
SET @Num1 = +5;
SELECT +@Num1;
GO


USE AdventureWorks;
GO
SELECT MAX(TaxRate), MIN(TaxRate), MAX(TaxRate) - MIN(TaxRate) AS 'Tax Rate Difference'
FROM Sales.SalesTaxRate
WHERE StateProvinceID IS NOT NULL;
GO

Declare @mydate datetime
Declare @nowdate datetime
set dateformat 'dmy'
SET @mydate = Convert(DateTime,'10/28/1982 10:00 AM',101);
SET @nowdate = Convert(Datetime,Convert(nchar(16),GetDate(),104),104)
select @nowdate
select @mydate
Select SubString((Convert(nchar(4),@nowdate - @mydate,112)),3,2) as MYAGE



USE AdventureWorks;
GO
SELECT ProductID, Name, ListPrice, ListPrice * 1.15 AS NewPrice, ListPrice * 0.15 as INC
FROM Production.Product
WHERE Name LIKE 'Mountain-%'
ORDER BY ProductID ASC;
GO


USE AdventureWorks;
GO
SELECT SalesPersonID, FirstName, LastName, SalesQuota, SalesQuota/12 AS 'Sales Target Per Month'
FROM Sales.SalesPerson s 
    JOIN HumanResources.Employee e ON s.SalesPersonID = e.EmployeeID
    JOIN Person.Contact c ON e.ContactID = c.ContactID;

--Select 
--2200 as monthlySGD, 
--2200 * 800 as montlyMMK,  
--2200 * 12 as yearlySGD,  
--2200 * 12 * 800 as yearlyMMK,
--2200 * .5 * 12 as SavingSGD,
--2200 * 12 * .5 * 800 as SavingMMK
--
--delcal
--select 1500/2200 as Rate




